﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QFileDialog>
#include <QSettings>
#include <QFile>
#include <QImage>
#include <QButtonGroup>
#include <QThread>
#include "baidufaceonline.h"
#include "screenwidget.h"
#include "parameters.h"
#include "cameraview.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void closeEvent(QCloseEvent* event);
    void setIniFile(const QString& api_key, const QString& secret_key);

private slots:
    void reciveCapturedImage(int id, const QImage& preview);
    void readCapturedImage(int id, const QString& fileName);

    void drawPixmap(const QPixmap& pixmap);
    void getFaceverifyResult(const QString& result);
    void getDetectResult(const QString&  content);
    void getMatchResult(const QString&  content);
    void getSerchResult(const QString&  content);
    void getRegisterResult(const QString&  content);

    void on_open_img_triggered();

    void on_act_baidu_triggered();

    void on_shot_screen_triggered();

    void on_help_about_triggered();

    void on_actSetPara_triggered();

    void on_face_register_clicked();

    void on_ActGrabImage_triggered();

    void on_ActCameraView_triggered();

    void on_ActCloseCamera_triggered();

private:
    Ui::MainWindow *ui;
    QButtonGroup* ButtonG = nullptr;

    BaiduFaceOnline* BaiduFace = nullptr;
    ScreenWidget* swidget = nullptr;
    CameraView cameraview;

    QImage Image;
};
#endif // MAINWINDOW_H
